package com.briup.service.impl;

import com.briup.dao.BookDao;
import com.briup.dao.CategoryDao;
import com.briup.dao.extend.BookExtendDao;
import com.briup.exception.ServiceException;
import com.briup.pojo.Book;
import com.briup.pojo.Category;
import com.briup.pojo.extend.BookExtend;
import com.briup.result.ResultCode;
import com.briup.service.BookService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.util.StringUtils;

import java.util.List;

@Service
public class BookServiceImpl implements BookService {

    @Autowired
    private BookExtendDao bookExtendDao;
    @Autowired
    private BookDao bookDao;

    @Override
    public List<BookExtend> getBooksByCondition(String keyword, Integer categoryId) {
        return bookExtendDao.selectBooksByCondition(keyword, categoryId);
    }

    @Override
    public void addBook(Book book) {
        // 对于book做一些逻辑上的处理
        book.setStatus(0);
        bookDao.insertBook(book);
    }

}
